-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Timestamp.__sub__(datetimelike) support non-nano #47346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# case with non-lossy rounding | ||
ts = ts_tz | ||
|
||
# choose a unit for `other` that doesn't match ts_tz's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind expanding on this comment that reso parameterization does test the >
and <
test?
assert result.value == 0 | ||
assert result._reso == min(ts._reso, other._reso) | ||
|
||
# TODO: clarify in message that add/sub is allowed only when lossless? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also regarding the "losslessly" error message, would nice to clarify the loss e.g. f"Could not losslessly covert {reso1} to {reso2}. {mod} {reso1} would be lost"
updated. getting the |
* ENH: Timestamp +- timedeltalike scalar support non-nano * ENH: Timestamp.__sub__(datetime) with non-nano * better exception message
With mixed resos, cast to the lower reso, and only if doing so is lossless.